package com.ruoyi.business.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.ruoyi.business.domain.BizBind;
import com.ruoyi.business.domain.BizLight;
import com.ruoyi.business.domain.BizScore;
import com.ruoyi.business.mapper.BizLightMapper;
import com.ruoyi.common.db.BaseService;
import com.ruoyi.common.db.CacheService;
import org.checkerframework.checker.interning.qual.FindDistinct;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * <pre>
 *
 * </pre>
 *
 * @author zhangli
 * @since 2023/10/22
 */
@Component
public class BizLightDataService extends BaseService<Integer, BizLight> {


    public List<BizLight> getAllByUserNumber(String userNumber){
        QueryWrapper<BizLight> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("from_number",userNumber).or().eq("to_number",userNumber);

        return selectList(queryWrapper);
    }

    public List<BizLight> getByLightNumber(String lightNumber){
        QueryWrapper<BizLight> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("light_number",lightNumber);

        return selectList(queryWrapper);
    }


    public List<BizLight> getAllByLightPulse(String lightPulse){
        QueryWrapper<BizLight> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("light_pulse",lightPulse);

        return selectList(queryWrapper);
    }

    public int getTotalPerson(){
        return ((BizLightMapper)getDbService().getBaseMapper()).selectTotal();
    }


}
